# url：http://www.bjhospital.net/
# 用例1：
# 搜索骨科—>点击搜索—>点击出来的第一个链接—>断言文本内容
# import time
# url = "http://www.bjhospital.net/"
# from selenium import webdriver
# from selenium.webdriver.common.by import By
# driver = webdriver.Chrome()
# driver.get(url)
# driver.implicitly_wait(15)
# driver.maximize_window()
# # 搜索骨科
# driver.find_element(By.CLASS_NAME,"keyword").send_keys("骨科")
# # 点击搜索
# driver.find_elements(By.CLASS_NAME,"btn")[0].click()
# # 点击出来的第一个链接
# # 先收集所有的a标签
# all_a = driver.find_elements(By.TAG_NAME,"a")
# for i in all_a:
#     # get_attribute 通过元素名获取元素值
#     if i.get_attribute("href") == "http://www.bjhospital.net/notes_new/2023/DbDql6dl.html":
#         i.click() # 找到就点击
#         break
# # 句柄切换
# driver.switch_to.window(driver.window_handles[-1]0)
# time.sleep(2)
# # 先定位到父节点
# content = driver.find_element(By.CLASS_NAME,"content")
# # 再定位子节点：这个时候，text就是h1标签了
# text = content.find_element(By.TAG_NAME,"h1").text
# print(text)
# # 断言文本内容
# assert "毕节市第一人民医院高值医用耗材网上阳光平台议价意向公开" == text
# time.sleep(7)
#



